import React, { Component } from 'react';
import { connect } from 'dva';
import TabsChart from './components/TabsChart';

/**
 * 盈利分析
 */
class Profit extends Component {
  componentDidMount() {
    const { dispatch } = this.props;
    dispatch({
      type: 'finance/getCharts',
      payload: {
        dataType: 'Profit',
        descKey: 'yl',
      },
    });
  }

  render() {
    const tabs = [
      {
        tab: '净资产收益率ROE',
        key: 0,
      },
      {
        tab: '总资产净利率ROA',
        key: 1,
      },
      {
        tab: '销售毛利率',
        key: 2,
      },
      {
        tab: '销售净利率',
        key: 3,
      },
      {
        tab: '销售期间费用率',
        key: 4,
      },
      {
        tab: '销售费用率',
        key: 5,
      },
      {
        tab: '资产减值损失/营业总收入',
        key: 6,
      },
      {
        tab: '营业利润/营业收入',
        key: 7,
      },
      {
        tab: '营业外收支净额/利润总额',
        key: 8,
      },
    ];
    return <TabsChart tabs={tabs} />;
  }
}

export default connect()(Profit);
